<template>
  <div class="order">
    <div class="scrl">
      <div class="main">
        <div class="head">
          <span @click="back">＜</span>
          <span>我的订单</span>
          <span @click="show" v-if="isshow">取消</span>
          <span @click="show" v-else>编辑</span>
        </div>
        <van-tabs v-model="act">
          <van-tab title="全部">
            <all :hid="isshow" @childevent="parentevent"></all>
          </van-tab>
          <van-tab title="待付款">
            <pay :hid="isshow" @childevent="parentevent"></pay>
          </van-tab>
          <van-tab title="待评价">
            <say :hid="isshow" @childevent="parentevent"></say>
          </van-tab>
          <van-tab title="待退款">
            <back :hid="isshow" @childevent="parentevent"></back>
          </van-tab>
        </van-tabs>
      </div>
      <router-view />
    </div>
  </div>
</template>

<script>
import all from "./componts/all.vue";
import pay from "./componts/pay.vue";
import say from "./componts/say.vue";
import back from "./componts/back.vue";
import BScroll from "@better-scroll/core";
export default {
  data() {
    return {
      act: 0,
      bScroll: "",
      isshow: false
    };
  },
  components: {
    all,
    pay,
    say,
    back
  },
  computed: {},
  created() {
    this.act = Number(this.$route.params.id);
    // console.log(this.act,this.$route.params.id)
  },
  mounted() {},
  methods: {
    back() {
      this.$router.push("/user");
    },
    show() {
      this.isshow = !this.isshow;
    },
    parentevent() {
      this.show();
    }
  }
};
</script>
<style lang="scss" >
.van-tab,
.van-tab--active {
  color: #ffffff;
}

.van-tabs__nav {
  background-color: rgba(35, 38, 45, 1);
  z-index: 10;
  transform: translateY(-1px);
}

.van-tab__pane-wrapper {
  z-index: 1;
}

.van-tabs__line {
  background-color: #f9c34a;
}
.van-hairline--top-bottom::after,
.van-hairline-unset--top-bottom::after {
  border: none;
}
</style>
<style scoped lang="scss">
.order {
  overflow: hidden;
  width: 100%;
  height: 100%;
  background: rgba(35, 38, 45, 1);
  color: #ffffff;
  .main {
    overflow: hidden;
    width: calc(100% - 40px);
    margin: 0 auto;
    .head {
      position: relative;
      display: flex;
      margin: 0 auto;
      justify-content: space-between;
      align-items: center;
      line-height: 60px;
      font-size: 16px;
      background-color: #23262d;
      z-index: 10;
      :last-child {
        color: #f9c34a;
        border: 1px solid #f9c34a;
        width: 42px;
        line-height: 30px;
        border-radius: 2px;
      }
      :nth-child(2) {
        margin-left: 20px;
      }
      :first-child {
        text-align: left;
        width: 30px;
      }
    }
  }
}
</style>
